home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 602 / Help-FilesOPLDeveloppers.sis / S5 OPX extra (.txt) < prev    next >
Encoding:
EPOC Database  |  2000-10-04  |  16.8 KB  |  209 lines

  1. "Data.app!@
  2. Table1
  3. ColA9
  4. ColB9
  5. ColA10
  6. ColB10
  7. Table1
  8. Name:
  9. 2Description:
  10. Courier
  11. Arial
  12. *CThese functions duplicate the functions of the same name in Dbase.opx. The only difference is that the functions here can also be used when some table of the dbase$ is currently open in your program.
  13. Note that the documentation for the DbGetFieldType&: function in the first OPL manual has the type numbering wrong.  The correct numbers are:
  14. value  type
  15. --------------
  16. 0  bit
  17. 1  signed byte (8 bits)
  18. 2  unsigned byte (8 bits)
  19. 3  integer (16 bits)
  20. 4  unsigned integer (16 bits)
  21. 5  long integer (32 bits)
  22. 6  unsigned long integer (32 bits)
  23. 7  64-bit integer
  24. 8  single precision floating-point number (32 bits)
  25. 9  double precision floating-point number (64 bits)
  26. 10 date/time object
  27. 11 ASCII text
  28. 12 Unicode text
  29. 13 Binary
  30. 14 LongText8
  31. 15 LongText16
  32. 16 LongBinary
  33. The four OPL types are types 3, 5, 9, and 11.
  34. EThese two functions correspond to the built-in OPL commands OPENR and OPEN.  The difference is that these functions take the field types from the string fieldTypes$, and that all types supported by EPOC/32's DBMS are allowed.
  35. LogicalName& is a number indicating the logical Name to open:  0 is A, 1 is B, 2 is C, and so on.
  36. FieldTypes$ must have exactly one character for every field, with the following meaning:
  37.  "$" : an OPL string field
  38.  "%" : an OPL integer field,
  39.  "&" : an OPL long integer field,
  40.  "." : an OPL real field,
  41.  "?" : any other field.
  42. An example:  The built-in OPL line
  43.  OPEN "c:\test SELECT name, age, income, height FROM Employee", C, f1$, f2%, f3&, f4
  44. would correspond to the OPX function call:
  45.  ODbOPEN:(2, "C:\test SELECT name, age, income, height FROM Employee", "$%&.")
  46. The two expressions are really completely identical. You can use C.F1$, C.F2% etc to access the values of the fields, or, alternatively, you can use the ODbGetXxx and ODbPutXxx functions described below.
  47. On the other hand:
  48.  ODbOpen:(3, "C:\test SELECT name, married, children, birthday, cv FROM Employees", "$????")
  49. could be used if name is a string field, married a boolean field (Yes/No), children a byte field, birthday a DateTime object, and cv a long text field. You can use D.F1$ to access the name, but you will need to use ODbGetWord&:,  ODbGetInt&:, ODbGetDateTime:, and ODbGetLong: to read the values of the other fields in this database.
  50. Use CLOSE to close a database opened using these functions.
  51. uEThese functions can be used to create a new table with name tableName$ in the database fileName$.  Call ODbStartTable: first to start setting up the creation process. Then call ODbTableField: once for every field in the new table.  FieldName$ is the DBMS name of the field, and type& its DBMS Type (these are the same numbers as returned by the DbGetFieldType&: and ODbGetFieldType&: functions.  (Please be aware that the documentation of DbGetFieldType& in the OPL manual is wrong! See above for the correct numbers.)  The length& argument determines the maximum length of string and binary fields (Types 11 and 13). For all numeric types (Types 0 to 10), the length& argument determines whether the field can be empty. Use &0 if it can be empty (this is the normal case for OPL databases), or &1 if it cannot be empty.  Setting this argument to &1 saves one bit per field per row of your database. The ODbCreateTable: call actually creates the table. Note that this function DOES NOT open a new view on the database.  An eempty table is created in the database. If you want to write to it, you have to open it using ODbOpen:.  If the fileName$ does not exist, it is created as an OPL database file.  This mechanism does not handle the SETDOC command.  If you want to create an OPL document file, you will need to create it using OPL's create command, and then add a table using ODbCreateTable:.
  52. UAReturn the contents of the i& field in the current database as a string. This is normally used for ASCII text and binary fields (types 11 and 13), but can actually be used for any type except for long types.Fields are counted starting from one.
  53. The usual OPL syntax:
  54.   name$ = C.nam$
  55. would translate to:
  56.   USE C
  57.   name$ = ODbGetString$:(1)
  58. !ODbGetTableCount&:(path$) _OplDb
  59. BReturns the number of tables in the database with filename path$.
  60. $ODbGetTableName$:(path$, i&) _OplDb
  61. 6Returns the name of the i&th table in database path$.
  62. )ODbGetIndexCount&:(path$, table$) _OplDb
  63. NReturns the number of indices for table$ in the database with filename path$.
  64. ,ODbGetIndexName$:(path$, table$, i&) _OplDb
  65. ?Returns the name of the i&th index for table$ in the database.
  66. 7ODbGetIndexDescription$:(path$, table$, index$) _OplDb
  67. JReturns a string describing the key of index$ for table$ in the database.
  68. ODbGetFieldCount&:(dbase$,table$)
  69. ODbGetFieldName$:(dbase$,table$,fieldNum&)
  70. ODbGetFieldType&:(dbase$,table$,fieldNum&) _OplDb
  71. ,ODbGetFieldSize&:(path$, table$, i&) _OplDb
  72. ~Returns the size of the i&th field in table$ in the database. This is the length of string fields, otherwise it is undefined.
  73. -ODbGetCanBeEmpty%:(path$, table$, i&) _OplDb
  74. UReturns -1 if the i&th field in table$ in the database can be empty, zero otherwise.
  75. \ODbOpenR:(logicalName&, sql$, fieldTypes$)
  76. ODbOpen:(logicalName&, sql$, fieldTypes$) _OplDb
  77. hODbStartTable:
  78. ODbTableField:(fieldName$, type&, length&)
  79. ODbCreateTable:(fileName$, tableName$) _OplDb
  80. ODbGetLength&:(i&) _OplDb
  81. Returns the length of the i& field in the current database. If the field is empty, returns zero. Otherwise it returns 1 for any numeric field (types 0 to 10), and the length in bytes for text, binary, long text, and long binary fields.
  82. ODbGetString$:(i&) _OplDb
  83. ODbGetInt&:(i&) _OplDb
  84. Return the contents of the i& field in the current database. This has to be a signed integer field (types 1, 3, 5).
  85. The usual OPL syntax:
  86.   age% = C.age%
  87.   salary& = C.sal&
  88. would translate to:
  89.   USE C
  90.   age% = ODbGetInt&:(2)
  91.   salary& = ODbGetInt&:(3)
  92. ODbGetReal:(i&) _OplDb
  93. hReturn the contents of the i& field in the current database. This has to be an OPL real field (type 9).
  94. ODbGetReal32:(i&) _OplDb
  95. iReturn the contents of the i& field in the current database. This has to be a short real field (type 8).
  96. ODbGetWord&:(i&) _OplDb
  97. zReturn the contents of the i& field in the current database. This has to be an unsigned integer field (types 0, 2, 4, 6).
  98. AGet length& bytes from the i& field in the current database, and place it in the buffer&.  The field must be a long field type (types 14, 15, 16). Normally you would first read the length of a long field using ODbGetLength&: and use this as the length& argument for this function.
  99. FAThis function is used similar to the built-in function FINDFIELD, in particular the flag% argument and the return value have the same meaning. The difference is that the sqlString$ argument is used as an SQL query. So you can have a query like:
  100. ODbFindWhere%:("name LIKE '*Miller*' AND (height > 1.80 OR salary < 20000)", 1)
  101. #ODbGetDateTime:(dtime&, i&) _OplDb
  102. Get the contents of the i& field in the current database, and place it in the datetime object dtime& (which must have been created using DTNewDateTime&: or DTNow&: from the Date.opx).  The field must be a date/time field (type 10).
  103. )ODbGetLong:(buffer&, length&, i&) _OplDb
  104. ODbPutEmpty:(i&) _OplDb
  105. .Makes field i& in the current database empty.
  106. "ODbPutString:(string$, i&) _OplDb
  107. Assigns the value of string$ to the i&th field in the current database.  This would normally be used for string or binary fields, or for long text or long binary fields, but it can actually be used for any type of field.
  108. ODbPutInt:(no&, i&) _OplDb
  109. ~Assigns the value of no& to the i&th field in the current database. The field must be a signed integer field (types 1, 3, 5).
  110. ODbPutReal:(f, i&) _OplDb
  111. gAssigns the value of f to the i&th field in the current database. The field must be an OPL real field.
  112. ODbPutReal32:(f, i&) _OplDb
  113. rAssigns the value of f to the i&th field in the current database.  The field must be a short real field (type 8).
  114. ODbPutWord:(no&, i&) _OplDb
  115. Assigns the value of no& to the i&th field in the current database.  The field must be an unsigned integer field (types 0, 2, 4, 6).
  116. #ODbPutDateTime:(dtime&, i&) _OplDb
  117. Assigns the value of the DateTime object dtime& to the i&th field in the current database.  The field must be a datetime field (type 10).
  118. )ODbPutLong:(buffer&, length&, i&) _OplDb
  119. Assigns the contents of the buffer& of length& to the i&th field in the current database.  The field must be a long field (type 14, 15, 16).
  120. k)ODbFindWhere%:(sqlString$, flag%) _OplDb
  121. ODbUse:(logicalName&) _OplDb
  122. Equivalent to the OPL command USE, but takes a number from 0 to 25 instead of a letter from A-Z as an argument.
  123.   USE C
  124. is identical to
  125.   ODbUse:(2)
  126. Table1
  127. Name:
  128. 2Description:
  129. Courier
  130. Arial
  131. #ODbGetDateTime:(dtime&, i&) _OplDb
  132. Get the contents of the i& field in the current database, and place it in the datetime object dtime& (which must have been created using DTNewDateTime&: or DTNow&: from the Date.opx).  The field must be a date/time field (type 10).
  133. )ODbGetLong:(buffer&, length&, i&) _OplDb
  134. ODbPutEmpty:(i&) _OplDb
  135. .Makes field i& in the current database empty.
  136. "ODbPutString:(string$, i&) _OplDb
  137. Assigns the value of string$ to the i&th field in the current database.  This would normally be used for string or binary fields, or for long text or long binary fields, but it can actually be used for any type of field.
  138. ODbPutInt:(no&, i&) _OplDb
  139. ~Assigns the value of no& to the i&th field in the current database. The field must be a signed integer field (types 1, 3, 5).
  140. ODbPutReal:(f, i&) _OplDb
  141. gAssigns the value of f to the i&th field in the current database. The field must be an OPL real field.
  142. ODbPutReal32:(f, i&) _OplDb
  143. rAssigns the value of f to the i&th field in the current database.  The field must be a short real field (type 8).
  144. ODbPutWord:(no&, i&) _OplDb
  145. Assigns the value of no& to the i&th field in the current database.  The field must be an unsigned integer field (types 0, 2, 4, 6).
  146. #ODbPutDateTime:(dtime&, i&) _OplDb
  147. Assigns the value of the DateTime object dtime& to the i&th field in the current database.  The field must be a datetime field (type 10).
  148. )ODbPutLong:(buffer&, length&, i&) _OplDb
  149. Assigns the contents of the buffer& of length& to the i&th field in the current database.  The field must be a long field (type 14, 15, 16).
  150. k)ODbFindWhere%:(sqlString$, flag%) _OplDb
  151. ODbUse:(logicalName&) _OplDb
  152. Equivalent to the OPL command USE, but takes a number from 0 to 25 instead of a letter from A-Z as an argument.
  153.   USE C
  154. is identical to
  155.   ODbUse:(2)
  156. {#Syntax of OPX-files not from Psion
  157. vs 1 01-08-98
  158. Currently covers only OplDb.
  159. For availability of OPX-files see
  160. http://www.mcaleely.com/psion/OPX/
  161. This file is available, along with other doc in DATA, at
  162. http://www.knoware.nl/users/wsmout/s5doc.html
  163. comments to wsmout@knoware.nl
  164. #ODbGetDateTime:(dtime&, i&) _OplDb
  165. Get the contents of the i& field in the current database, and place it in the datetime object dtime& (which must have been created using DTNewDateTime&: or DTNow&: from the Date.opx).  The field must be a date/time field (type 10).
  166. )ODbGetLong:(buffer&, length&, i&) _OplDb
  167. ODbPutEmpty:(i&) _OplDb
  168. .Makes field i& in the current database empty.
  169. "ODbPutString:(string$, i&) _OplDb
  170. Assigns the value of string$ to the i&th field in the current database.  This would normally be used for string or binary fields, or for long text or long binary fields, but it can actually be used for any type of field.
  171. ODbPutInt:(no&, i&) _OplDb
  172. ~Assigns the value of no& to the i&th field in the current database. The field must be a signed integer field (types 1, 3, 5).
  173. ODbPutReal:(f, i&) _OplDb
  174. gAssigns the value of f to the i&th field in the current database. The field must be an OPL real field.
  175. ODbPutReal32:(f, i&) _OplDb
  176. rAssigns the value of f to the i&th field in the current database.  The field must be a short real field (type 8).
  177. ODbPutWord:(no&, i&) _OplDb
  178. Assigns the value of no& to the i&th field in the current database.  The field must be an unsigned integer field (types 0, 2, 4, 6).
  179. #ODbPutDateTime:(dtime&, i&) _OplDb
  180. Assigns the value of the DateTime object dtime& to the i&th field in the current database.  The field must be a datetime field (type 10).
  181. )ODbPutLong:(buffer&, length&, i&) _OplDb
  182. Assigns the contents of the buffer& of length& to the i&th field in the current database.  The field must be a long field (type 14, 15, 16).
  183. k)ODbFindWhere%:(sqlString$, flag%) _OplDb
  184. ODbUse:(logicalName&) _OplDb
  185. Equivalent to the OPL command USE, but takes a number from 0 to 25 instead of a letter from A-Z as an argument.
  186.   USE C
  187. is identical to
  188.   ODbUse:(2)
  189. {$ Syntax of OPX-files not from Psion
  190. vs 1 01-08-98
  191. Currently covers only OplDb.
  192. For availability of OPX-files see
  193. http://www.mcaleely.com/psion/OPX/
  194. This file is available, along with other doc in DATA, at
  195. http://www.knoware.nl/users/wsmout/s5doc.html
  196. comments to wsmout@knoware.nl
  197. Table1
  198. Name:
  199. 2Description:
  200. Courier
  201. Arial
  202. Table1
  203. ColA9
  204. ColB9
  205. ColA10
  206. ColB10
  207. Index1
  208. ColA9
  209.